package com.yc.springmvc.core;

import java.lang.reflect.Method;
import java.util.Arrays;

public class HandlerMapperInfo {
	private Method method;
	private Object object;
	private Object[] args;
	
	
	
	public HandlerMapperInfo(Method method, Object object) {
		super();
		this.method = method;
		this.object = object;
	}

	public HandlerMapperInfo() {
		super();
	}

	@Override
	public String toString() {
		return "HandlerMapperInfo [method=" + method + ", object=" + object + ", args=" + Arrays.toString(args) + "]";
	}

	public Method getMethod() {
		return method;
	}

	public void setMethod(Method method) {
		this.method = method;
	}

	public Object getObject() {
		return object;
	}

	public void setObject(Object object) {
		this.object = object;
	}

	public Object[] getArgs() {
		return args;
	}

	public void setArgs(Object[] args) {
		this.args = args;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Arrays.deepHashCode(args);
		result = prime * result + ((method == null) ? 0 : method.hashCode());
		result = prime * result + ((object == null) ? 0 : object.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		HandlerMapperInfo other = (HandlerMapperInfo) obj;
		if (!Arrays.deepEquals(args, other.args))
			return false;
		if (method == null) {
			if (other.method != null)
				return false;
		} else if (!method.equals(other.method))
			return false;
		if (object == null) {
			if (other.object != null)
				return false;
		} else if (!object.equals(other.object))
			return false;
		return true;
	}
	
}
